<?php

use App\Http\Controllers\DevController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

// 登录接口
Route::post('/login', [LoginController::class, 'login']);

// 需要jwt的路由组
Route::middleware(['jwt'])->group(function () {
    // 获取个人信息
    Route::get('/self', [LoginController::class, 'self']);
    Route::get('/menu', [LoginController::class, 'menu']);
    Route::get('/group', [LoginController::class, 'groupList']);
    Route::post('/group/menu', [LoginController::class, 'setGroupMenu']);
    Route::post('/group/user', [LoginController::class, 'setGroupUser']);

    Route::get('/user/list', [UserController::class, 'list']);
});

// 需要jwt, admin的路由组
Route::middleware(['jwt', 'admin'])->group(function () {
    Route::post('/dev', [DevController::class, 'execute']);
});


//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});
